Hello,
Regexp URL = regexp2 "??????"
string txt3 = "name;description;(outward or inward);(openAsURL or none);path"
if (URL txt3)
{
print txt3[match 0] "\n" // first section in ()
print txt3[match 1] "\n" // second section in ()
print txt3[match 2] "\n" // third section in ()
print txt3[match 3] "\n" // fourth section in ()
print txt3[match 4] "\n" // fifth section in ()
}
SystemAdmin - Thu Aug 16 21:06:42 EDT 2012 |
Re: Regexp (object text)
Without additional details, this is how I interpreted your question:
Regexp URL = regexp2 "^([^;]*);([^;]*);([^;]*);([^;]*);(.*)$"
string txt3 = "name;description;(outward or inward);(openAsURL or none);path"
if (URL txt3)
{
print txt3[match 0] "\n" // full match
print txt3[match 1] "\n" // first section in ()
print txt3[match 2] "\n" // second section in ()
print txt3[match 3] "\n" // third section in ()
print txt3[match 4] "\n" // fourth section in ()
print txt3[match 5] "\n" // fifth section in ()
}
|
Re: Regexp (object text) Or maybe you want this
Regexp URL = regexp2 "^([^;]*);([^;]*);(outward|inward);(openAsURL|none);(.*)$"
string txt3 = "name;description;outward;none;path;and;more"
if (URL txt3)
{
print txt3[match 0] "\n" // full match
print txt3[match 1] "\n" // first section in ()
print txt3[match 2] "\n" // second section in ()
print txt3[match 3] "\n" // third section in ()
print txt3[match 4] "\n" // fourth section in ()
print txt3[match 5] "\n" // fifth section in ()
}
|
Re: Regexp (object text) SystemAdmin - Fri Aug 17 02:49:54 EDT 2012 Or maybe you want this
Regexp URL = regexp2 "^([^;]*);([^;]*);(outward|inward);(openAsURL|none);(.*)$"
string txt3 = "name;description;outward;none;path;and;more"
if (URL txt3)
{
print txt3[match 0] "\n" // full match
print txt3[match 1] "\n" // first section in ()
print txt3[match 2] "\n" // second section in ()
print txt3[match 3] "\n" // third section in ()
print txt3[match 4] "\n" // fourth section in ()
print txt3[match 5] "\n" // fifth section in ()
}
Thank you for the response, that is what I was looking for. My only question now is the a way of validating the path(syntax) like if it is a URL that it is correctly written or a network path, etc. I now that it will be hard to catch all incorrectly written paths but I would like to catch 80-90% of the mistakes(typos) prior to create the External Link. Once again thank you for all the help. -Jim |
Re: Regexp (object text) SystemAdmin - Fri Aug 17 02:49:54 EDT 2012 Or maybe you want this
Regexp URL = regexp2 "^([^;]*);([^;]*);(outward|inward);(openAsURL|none);(.*)$"
string txt3 = "name;description;outward;none;path;and;more"
if (URL txt3)
{
print txt3[match 0] "\n" // full match
print txt3[match 1] "\n" // first section in ()
print txt3[match 2] "\n" // second section in ()
print txt3[match 3] "\n" // third section in ()
print txt3[match 4] "\n" // fourth section in ()
print txt3[match 5] "\n" // fifth section in ()
}
I'm brain dead with Regular expressions, and so need to format them like this:
string re_sExternal = "^" // beginning of string -
"([^;]*)" // match 1 -
";" // -
"([^;]*)" // match 2 -
";" // -
"(outward|inward)" // match 3 -
";" // -
"(openAsURL|none)" // match 4 -
";" // -
"(.*)" // match 5 -
"$" // end of string
print "re_sExternal = [" re_sExternal "]\n"
Regexp re_External = regexp2(re_sExternal)
|